﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace SocketSuperLib
{
    /// <summary>
    /// 信息传输接口
    /// </summary>
    public interface IClient
    {  
        /// <summary>
        /// 连接Socket
        /// </summary> 
        /// <returns>true or false</returns>
        Boolean IConnect();
        /// <summary>
        /// 发送并获取返回信息
        /// </summary>
        /// <param name="byData">发送数据 byte</param>
        /// <param name="byBuffer">返回数据 byte</param>
        /// <param name="isShutdown">是否关闭连接</param>
        /// <returns>1 成功 其他 失败</returns>
        //int SendAndReturnMsg(ref byte[] byData, ref byte[] byBuffer,Boolean isShutdown);

        /// <summary>
        /// 发送并获取返回信息(该方法关闭连接)
        /// </summary>
        /// <param name="sendMsg">发送数据</param>
        /// <returns></returns>
        string SendAndReturnMsg(string sendMsg);
        /// <summary>
        /// 发送并获取返回信息(该方法关闭连接)
        /// </summary>
        /// <param name="sendMsg">发送数据</param>
        /// <param name="iTryTimes">尝试发送次数</param>
        /// <returns>返回数据 空串或有数据</returns>
        string SendAndReturnMsg(string sendMsg, int iTryTimes);

        /// <summary>
        /// 发送并获取返回信息(该方法关闭连接需要重新连接)
        /// </summary>
        /// <param name="sendMsg">发送数据</param>
        /// <param name="iTryTimes">尝试发送次数</param>
        /// <param name="isShutdown">是否关闭连接</param>
        /// <returns>返回数据 空串或有数据</returns>
        string SendAndReturnMsg(string sendMsg, int iTryTimes, Boolean isShutdown);
       
        /// <summary>
        /// 关闭连接
        /// </summary>
        /// <returns>1 成功 其他 失败</returns>
        int Close();
    }
}
